/**
 * @author Robert.Hu  2011-3-24
 * 
 */
package com.androidmarketdemo.model;

import com.androidmarketdemo.download.ApkDownloadService;
import com.androidmarketdemo.ui.views.AssertListItemAdapter;

import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;

/**
 * 
 */
public class OperationClickListner implements OnClickListener {

	private AssertListItemAdapter mAdapter = null;

	public OperationClickListner(AssertListItemAdapter adapter) {
		mAdapter = adapter;
	}

	/**
	 * @see android.view.View.OnClickListener#onClick(android.view.View)
	 * @param paramView
	 * 
	 */
	@Override
	public void onClick(View paramView) {
		int iItemIndex = ((Integer) paramView.getTag()).intValue();
		ApkInfo apkInfo = (ApkInfo) mAdapter.getItem(iItemIndex);
		if (apkInfo != null) {
			// FIXME: only for test
			try{
				paramView.getContext().startService(new Intent(paramView.getContext(),
						ApkDownloadService.class));
			}
			catch( Exception e ){
				e.toString();
				e.toString();
				
			}
			
		}

	}

}
